package com.bj58.groupbuy.action.service;

import java.util.List;

import com.bj58.groupbuy.action.model.Menu;
import com.bj58.groupbuy.action.model.User;
import com.bj58.groupbuy.wf.page.Paginate;

public interface UserManagerService{
	
	/**通过用户名查询USER信息
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	public User getUserByName (String userName) throws Exception;
	
	/**通过MD5查询USER信息
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	public User getUserByMd5 (String md5) throws Exception;
	
	/**通过用户名查询USER信息
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	public User getUserById(int uid) throws Exception;
	
	/**查询所有状态正常使用的用户
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	public List<User> getAllUsers () throws Exception;
	
	/**账号密码检验USER信息
	 * @param userName
	 * @param pwd
	 * @return
	 * @throws Exception
	 */
	public User checkUser(String userName,String pwd) throws Exception;
	
	/**分页查询USER列表
	 * @param pageIndex
	 * @param pageSize
	 * @param where
	 * @return
	 * @throws Exception
	 */
	public Paginate<User> getUserByPage (int pageIndex, int pageSize ,String where) throws Exception;
	
	/**保存新增用户
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public boolean saveUser(User user)throws Exception;
	
	
	/**新增用户及角色权限
	 * @param user
	 * @param roleIds
	 * @param functions
	 * @return
	 * @throws Exception
	 */
	public boolean saveUserRole(User user,String roleids,String functions,String opers)throws Exception;
	
	
	/**更新用户
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public boolean updateUser(User user)throws Exception;
	
	
	/**更新用户及角色权限
	 * @param user
	 * @param roleIds
	 * @param functions
	 * @return
	 * @throws Exception
	 */
	public boolean updateUserRole(User user,String roleids,String functions,String opers)throws Exception;


	/**获取用户的菜单权限
	 * @param user
	 * @return
	 * @throws Exception
	 */
	public String getFunctionsByUser(User user) throws Exception;
	
	
	public  String getNewAndOldUserFunc(User user, List<Menu> menuList)throws Exception ;
	
	
	/**检查用户权限
	 * @param user
	 * @param url  访问的url
	 * @return
	 * @throws Exception
	 */
	public boolean checkUserMenuFuns(User user,String url)throws Exception ;
		
}
